<?php
/**
 * 返回提示信息
 * @param $str
 * @param $backurl
 * @param int $time
 * @return string
 */
function showMsg($str, $backurl = '-1', $time = 2000)
{
    $str_build = '<div id="msg" style="width:300px;margin:0px auto;text-align: center;padding:10px;border:1px solid #ccc">';
    $str_build .= '<h3>提示信息</h3>';
    $str_build .= '<p>' . $str . '</p>';
    if($backurl=='-1'){
      $str_build .= '<p><a href="javascript:window.history.back();">返回</a></p>';
    }else{
      $str_build .= '<p><a href="javascript:window.location.href=\''.$backurl.'\'">返回</a></p>';
    }
    $str_build .= '</div>';
    $str_build.='<script type="text/javascript">';
    if($backurl=='-1')
    {
      $str_build.='setTimeout(function(){window.history.go(-1);},'.$time.')';
    }else{
      $str_build.='setTimeout(function(){window.location.href=\''.$backurl.'\';},'.$time.')';
    }
    $str_build.='</script>';

    return $str_build;
}

?>